package com.zx.chatclient.netty;

import java.util.List;

import com.zx.chatclient.dto.IMUser;

public class Client {

	private volatile static ClientHandler clientHander;

	private static IMUser user;

	private static List<IMUser> friendList;

	private static Thread thread = new Thread(new NettyClient());

	public static void start() {
		if (!thread.isAlive()) {
			thread.start();
		}
	}

	public static ClientHandler getClientHander() {
		if (clientHander == null) {
			synchronized (Client.class) {
				if (clientHander == null) {
					clientHander = new ClientHandler();
				}
			}
		}

		return clientHander;
	}

	public static IMUser getUser() {
		return user;
	}

	public static void setUser(IMUser user) {
		Client.user = user;
	}

	public static List<IMUser> getFriendList() {
		return friendList;
	}

	public static void setFriendList(List<IMUser> friendList) {
		Client.friendList = friendList;
	}

}
